package com.yan.demo;

import java.util.Random;

public class MethodDemo1 {
    public static void main(String[] args) {
        Random r = new Random();
        int num;
        num = r.nextInt(26) + 97;
        char xiaoZiMu = (char) num;
        System.out.println(xiaoZiMu);
    }
    public static void main1(String[] args) {
        int[] arr = {5,12,90,18,77,76,45,28,59,72};
        double[] newArr = newArr(arr);
        for (int i = 0; i < newArr.length; i++) {
            System.out.println(newArr[i]);
        }
    }

    public static double[] newArr(int[] arr){
        int max = arr[0];
        int min = arr[0];
        double sum = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] > max){
                max = arr[i];
            }
            if(arr[i] < min){
                min = arr[i];
            }
            sum += arr[i];
        }
        double avg = sum / arr.length;
        double[] arr1 = new double[4];
        arr1[0] = max;
        arr1[1] = min;
        arr1[2] = sum;
        arr1[3] = avg;
        return arr1;
    }

}
